# Contributor: Hugo Osvaldo Barrera <hugo@whynothugo.nl>
# Maintainer: Hugo Osvaldo Barrera <hugo@whynothugo.nl>
pkgname=ublock-origin
pkgver=1.54.0
pkgrel=0
pkgdesc="Efficient blocker add-on for Firefox"
url="https://github.com/gorhill/uBlock"
arch="noarch"
license="GPL-3.0-or-later"
makedepends="git python3 zip bash"
# Upstream's build script pulls latest master for uAssets.
# Pin the versions we use so we don't need network at built-time and the package
# sources are deterministic.
_uassets_master=eca63b20eb9b00450018f52bec3e4dde124b8e08
_uassets_ghpages=1b3464563bacd396fbfba470d0cf7c0a17a16911
source="ublock-origin-$pkgver.tar.gz::https://github.com/gorhill/uBlock/archive/refs/tags/$pkgver.tar.gz
	uAssets-$_uassets_master.tar.gz::https://github.com/uBlockOrigin/uAssets/archive/$_uassets_master.tar.gz
	uAssets-$_uassets_ghpages.tar.gz::https://github.com/uBlockOrigin/uAssets/archive/$_uassets_ghpages.tar.gz
"
builddir="$srcdir/uBlock-$pkgver"
options="!check" # no tests, build fetches assets

prepare() {
	default_prepare

	mkdir -p dist/build/uAssets
	mv ../uAssets-$_uassets_master dist/build/uAssets/main
	mv ../uAssets-$_uassets_ghpages dist/build/uAssets/prod
}

build() {
	make firefox
}

package() {
	install -Dm644 dist/build/uBlock0.firefox.xpi "$pkgdir/usr/lib/firefox/browser/extensions/uBlock0@raymondhill.net.xpi"
}

sha512sums="
388453c24c9af3adbfc57d58514dbeb9ac4394a69c37037db35cd4b9ce9a0103af1d0b986a882df3291777de33a58ef5ceb2793cad3bbb05dc4fd59abf03f35f  ublock-origin-1.54.0.tar.gz
6d2237cea02255f416b4384ef1e75190bb849ceab553f97549dda7121f49f8d785922eaa294c59c7780c9f6905ade645f23f729a5b42673c66e1d8064d1a94f1  uAssets-eca63b20eb9b00450018f52bec3e4dde124b8e08.tar.gz
35fa65448a67f96c40f1f96f5af48c07ba62fe2a270dc8f5d5f1a4037ba6283cd235b18191fcf70c4cd0d3ae2bc026da54e644c2d5bd4702955ff2863f7bf878  uAssets-1b3464563bacd396fbfba470d0cf7c0a17a16911.tar.gz
"
